$(function(){
    // rem
     (function(){
         let winWidth =  window.innerWidth;
         let size = (winWidth / 640) * 40;
         // 以 640 为例
         document.documentElement.style.fontSize = (size < 40 ? size : 40) + 'px' ;
     })();
    // scroll宽度
    $(".scroll-inset").width($(".scroll-inset").children().first().outerWidth(true) * $(".scroll-inset").children().length);
    // swiper
    var mySwiper = new Swiper('.swiper-container', {
        autoplay: 1000,  //可选选项，自动滑动
        loop:true
    });

//    模拟秒杀时间
    var times=$(".time");
    setInterval(function(){
        var guoqing = new Date('2017/12/29,14:00:00');
        var xianzai = new Date();
        var time = (guoqing-xianzai)/1000;
        //$(times[0]).find("span:eq(0)").text(Math.floor(time/(60*60*24*30)));
        time=time%(60*60*24*30);
        //$(times[0]).find("span:eq(0)").text(Math.floor(time/(60*60*24)));
        time=time%(60*60*24);
        $(times[0]).find("span:eq(0)").text(Math.floor(time/(60*60)));
        time=time%(60*60);
        $(times[0]).find("span:eq(1)").text(Math.floor(time/60));
        time=time%(60);
        $(times[0]).find("span:eq(2)").text(Math.floor(time));
    },1000);
    setInterval(function(){
        var guoqing = new Date('2017/12/30,04:00:00');
        var xianzai = new Date();
        var time = (guoqing-xianzai)/1000;
        //$(times[0]).find("span:eq(0)").text(Math.floor(time/(60*60*24*30)));
        time=time%(60*60*24*30);
        //$(times[0]).find("span:eq(0)").text(Math.floor(time/(60*60*24)));
        time=time%(60*60*24);
        $(times[1]).find("span:eq(0)").text(Math.floor(time/(60*60)));
        time=time%(60*60);
        $(times[1]).find("span:eq(1)").text(Math.floor(time/60));
        time=time%(60);
        $(times[1]).find("span:eq(2)").text(Math.floor(time));
    },1000);
    setInterval(function(){
        var guoqing = new Date('2017/12/30,08:00:00');
        var xianzai = new Date();
        var time = (guoqing-xianzai)/1000;
        //$(times[0]).find("span:eq(0)").text(Math.floor(time/(60*60*24*30)));
        time=time%(60*60*24*30);
        //$(times[0]).find("span:eq(0)").text(Math.floor(time/(60*60*24)));
        time=time%(60*60*24);
        $(times[2]).find("span:eq(0)").text(Math.floor(time/(60*60)));
        time=time%(60*60);
        $(times[2]).find("span:eq(1)").text(Math.floor(time/60));
        time=time%(60);
        $(times[2]).find("span:eq(2)").text(Math.floor(time));
    },1000);
    // 这是三个测试时间
    //var date1=new Date("2017/05/25,17:01:00");
    //var date2=new Date("2017/05/25,17:02:00");
    //var date3=new Date("2017/05/25,17:03:00");
    var date1=new Date("2017/12/29,14:00:00");
    var date2=new Date("2017/12/30,04:00:00");
    var date3=new Date("2017/12/30,08:00:00");
    var date=new Date();
//    时间判断开始
    if(date-date1>0){
        console.log("111");
        $(times[0]).parent().hide();
    }else if(date-date2>0){
        console.log("222");
        $(times[1]).parent().hide();
    }else if(date-date3>0){
        console.log("333");
        $(times[2]).parent().hide();
    }









});